<template>
  <div class="tabs row jc-around" :class="[customClass]">
    <div
      v-for="item in tabs"
      :key="item.value"
      class="cell row jc-center"
      @click="clickTab(item)"
    >
      <van-image
        :src="
          tab.value === item.value
            ? resource.award_tab_btn_active
            : resource.award_tab_btn
        "
        class="image"
      />
      {{ item.title }}
    </div>
  </div>
</template>

<script>
import resource from "@/utils/resource";
export default {
  props: {
    tabs: Array,
    initial: {
      default: 0,
      type: Number,
    },
    customClass: {
      default: "",
      type: String,
    },
  },
  data() {
    return {
      resource,
      tab: this.tabs[this.initial],
    };
  },
  methods: {
    clickTab(item) {
      this.tab = item;
      this.$emit("change", item);
    },
  },
};
</script>
<style lang="scss" scoped>
.tabs {
  height: 0.56rem;
  .cell {
    height: 100%;
    width: 1.28rem;
    position: relative;
    font-size: 0.28rem;
    color: #fff;
    .image {
      width: 1.28rem;
      height: 0.56rem;
      position: absolute;
      left: 0;
      top: 0;
    }
  }
}
</style>